package com.oa.xinxi.biz;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.oa.xinxi.dao.ZhuanTiWDMapper;
import com.oa.xinxi.entity.ZhuanTiWD;

@Service
public class ZhunTWDBiz {
	@Resource
	private ZhuanTiWDMapper mapper;
	public void save(ZhuanTiWD wd) {
		wd.setCreatetime(new Date());
		mapper.insert(wd);
	}
	public void deleteById(int id) {
		mapper.deleteByPrimaryKey(id);
	}
	public void update(ZhuanTiWD wd) {
		wd.setUpdatetime(new Date());
		ZhuanTiWD wd2 = mapper.selectByPrimaryKey(wd.getZtwdId());
		wd.setCreatetime(wd2.getCreatetime());
		wd.setCreator(wd2.getCreator());
		mapper.updateByPrimaryKeySelective(wd);
	}
	public ZhuanTiWD findById(Integer id) {
		return mapper.selectByPrimaryKey(id);
	}
	public List<ZhuanTiWD> findAll() {
		return mapper.findAll();
	}
}
